package main

import "fmt"

func subtractProductAndSum(n int) int {
	p := 1
	sum := 0
	for n != 0 {
		p *= n % 10
		sum += n % 10
		n = n / 10
		fmt.Println(p, sum)
	}
	return p - sum
}

func main() {
	a := subtractProductAndSum(4421)
	fmt.Println(a)
}
